#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableUnionBuildingDao:DaoBase<TableUnionBuilding>
    {
        public override string GetFileName()
        {
            return "TableUnionBuilding.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableUnionBuilding>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableUnionBuilding model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.buildingType)) UnityEngine.Debug.LogError("数据表id重复:TableUnionBuilding->id: " + model.buildingType);
            #endif
            cachePrimaryInt[model.buildingType] = model;
        }
        protected override TableUnionBuilding ParseRowData(string[] rowData)
        {
            TableUnionBuilding data = new TableUnionBuilding();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.buildingType = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.buildingName = rowData[1];
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.initBuildingLev = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.unlockPreUnionLev = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.bingNpcId = int.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.npcChat = rowData[5];
            }
            return data;
        }
    }
}
